[Shell] "sort -r +1 -2 +0 -1" 中 “+1 -2 +0 -1” 什么意思?
来源:百度知道 编辑:UC知道 时间:2024/06/05 19:08:19
awk '{print $1, $2 | "sort -r +1 -2 +0 -1"}' filename
这个脚本中“+1 -2 +0 -1”是什么意思,我也试过:
awk '{print $1, $2 | "sort -r +1 -2"}' filename 好像效果一样,有谁知道后面那些数字都是什么意思吗?
这个脚本中“+1 -2 +0 -1”是什么意思,我也试过:
awk '{print $1, $2 | "sort -r +1 -2"}' filename 好像效果一样,有谁知道后面那些数字都是什么意思吗?
先试sort +0 -1可知 按第1列首字母升序排序在第1列首字母相同的情况下按第2列首字母降序排列。
如果加上-r(-r就是逆序)则正好相反,
如果是sort -r +0 -1 就是按第1列首字母降序排序在第1列首字母相同的情况下按第2列首字母升序排列。
1
标准 sort 命令中 只有 +pos1 -pos2:
sort +pos1 -pos2
即先按 pos1 列排序, pos1 相同的再按 pos2排序
没有 +pos1 -pos2 +pos3 -pos4 形式。
+pos1 -pos2 +pos3 -pos4 后面的pos3可能会覆盖pos1,pos4可能会覆盖pos2。
你分别试一下:
sort -r +0 -1 filename
sort -r +1 -2 filename
就知道了。
-r 是反序,由大到小排序
"shell"是什么?
what's the ingradients in the egg shell?
开机出现"cannot start shell application"
请问"shell"做英文名会奇怪吗?
Set WshShell = server.CreateObject("Wscript.Shell")
为什么不能创建对象??Set RegWsh = CreateObject("WScript.Shell")
为什么有些网站不能直接用FTP上传而只能用"SSH Secure Shell"
AutoCAD2006老是出现"无法找到 SHELL 程序"编不了字
VB 关于ShellExecute和Shell打开快捷方式的"幽灵"问题
瑞星显示"rising realtime monitor shell" 停止工作为什么